import Vue from 'vue'
import Router from 'vue-router'
const Home = () =>
  import('../views/home/Home.vue')
const CateGory = () =>
  import('../views/category/CateGory.vue')
const Cart = () =>
  import('../views/cart/Cart.vue')
const Porfile = () =>
  import('../views/porfile/Porfile.vue')
// import HelloWorld from '@/components/HelloWorld'


Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  this.$router.replace(this.path).catch(err => err)
}
// Vue.use(Router)
const routers = [{
    path: "",
    redirect: '/home'
  }, {
    path: "/home",
    component: Home
  },
  {
    path: "/porfile",
    component: Porfile
  },
  {
    path: "/cart",
    component: Cart
  },
  {
    path: "/category",
    component: CateGory
  },

]

const router = new Router({
  routers,
  mode: "history"
  // routes: [{
  //     path: '/',
  //     // name: 'HelloWorld',
  // component: HelloWorld
  // }]
})
// 导出router
export default router
